﻿using UnityEngine;
using System.Collections;

public enum TorchAnimations {
	IDLE = 0,
	LIT,
	NUM_ANIMS
}

public class Torch : Objective {

	public CharacterAnimation[] animations;
	public CharacterAnimator animator;

	bool _isOnFire;

	// Use this for initialization
	new void Start () {
		base.Start ();

		animator = GetComponent<CharacterAnimator> ();
		
		animator.ChangeAnimation(animations[(int)TorchAnimations.IDLE], 0);
	}
	
	// Update is called once per frame
	void Update () {
	
	}

	void OnTriggerStay2D(Collider2D other) {
		if (other.tag == "Player" && !_isOnFire) {
			if(other.GetComponent<Player>().isOnFire) {
				_isOnFire = true;
				animator.ChangeAnimation(animations[(int)TorchAnimations.LIT], 0);
				Completed();
				// Set up objective for torches
			}
		}
	}
}
